package com.example.controller;

import com.example.common.result.Result;
import com.example.entity.hz.Messageconfiguration;
import com.example.service.MessageconfigurationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@CrossOrigin // 跨域
@RestController
@RequestMapping("/api/MessageConfiguration")
@Api(tags = "消息(模板)配置前端控制器")
public class MessageConfigurationController {

    @Resource
    private MessageconfigurationService messageconfigurationService;

    @ApiOperation("新增消息通知模版 批量或单独")
    @PostMapping("/saveMessageConfiguration")
    public Result saveMessageConfiguration(@RequestBody List<Messageconfiguration> messageconfigurationList){
        return this.messageconfigurationService.saveMessageConfiguration(messageconfigurationList);
    }

    @ApiOperation("删除消息通知模版 批量或单独")
    @PostMapping("/deleteMessageConfiguration")
    public Result deleteMessageConfiguration(@RequestBody List<Integer> uidList){
        return this.messageconfigurationService.deleteMessageConfiguration(uidList);
    }

    @ApiOperation("通过uid查询消息通知模版详细信息")
    @GetMapping("queryOneMessageConfiguration/{uid}")
    public Result<Messageconfiguration> queryOneMessageConfiguration(@PathVariable Integer uid){
        return this.messageconfigurationService.queryOneMessageConfiguration(uid);
    }

    @ApiOperation("修改消息通知模版信息")
    @PostMapping("updateMessageConfiguration")
    public Result updateMessageConfiguration(@RequestBody Messageconfiguration messageconfiguration){
        return this.messageconfigurationService.updateMessageConfiguration(messageconfiguration);
    }
}

